#pragma once

#include <stdint.h>

struct rt_spi_device;

namespace NXMFC
{

class bmi088
{
public:
    bmi088();
    ~bmi088();

    bool open(const char *acc, const char *gry);
    bool readAccel(short &x, short &y, short &z);
    bool readGyro(short &x, short &y, short &z);

private:
    bool init();
    uint8_t accelReadID();
    void accelReadRegs(uint8_t addr, uint8_t *data, uint16_t len);
    void gyroReadRegs(uint8_t addr, uint8_t *data, uint16_t len);
    uint8_t gyroReadID();
    void writeReg(int id, uint8_t addr, uint8_t val);

private:
    struct rt_spi_device *_acc;
    struct rt_spi_device *_gry;
};

}
